package performance;

import static com.google.common.collect.Maps.newHashMap;

import java.util.Map;
import java.util.Map.Entry;

import net.ftng.commons.lang.Monitor;
import net.ftng.commons.lang.utils.MonitorUtils;

import org.junit.Test;

public class Loop {

    private final long size = 50000;

    @Test
    public void map() {

        Map<Long, Long> testMap1 = newHashMap();
        Map<Long, Long> testMap2 = newHashMap();
        for (long i = 1; i <= size; i++) {
            testMap1.put(i, i);
            testMap2.put(i, i);
        }

        Monitor monitor = MonitorUtils.getMonitor(this.getClass().getSimpleName(), "map");
        monitor.start();
        for (Entry<Long, Long> entry : testMap1.entrySet()) {
            testMap2.containsKey(entry.getKey());
        }
        monitor.stopAndprintResult();

    }
}
